Android Software Development: A Collection of Practical Projects (Android Programming Book 1) by Mark Wickham

Android Software Development: A Collection of Practical Projects (Android Programming Book 1) by Mark Wickham

Author:Mark Wickham [Wickham, Mark]
Language: eng
Format: epub
Published: 2017-01-14T08:00:00+00:00


return(super.onCreateOptionsMenu(menu));

}

@Override

public boolean onOptionsItemSelected(MenuItem item) {

if (item.getItemId() == R.id.exit) {

finish();

return(true);

}

if (item.getItemId() == R.id.crash) {

// simulate a crash right here, lets do an Index out of bounds condition ...

String[] crashArray = new String[] {"one","two"};

crashArray[2] = "oops";

return(true);

}

return(super.onOptionsItemSelected(item));

}

<?xml version="1.0" encoding="utf-8"?>

<menu xmlns:android="http://schemas.android.com/apk/res/android">

<item

android:id="@+id/exit"

android:showAsAction="always|withText"

android:title="@string/exit"/>

<item

android:id="@+id/crash"

android:showAsAction="always|withText"

android:title="@string/crash"/>

</menu>



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.